/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.tech15.pub.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.pub.model.*;
import com.tech15.pub.dao.*;
import com.tech15.pub.service.*;
import com.tech15.pub.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "ATTENDANCE")
public class Attendance extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "考勤记录";
	public static final String ALIAS_ID = "序号";
	public static final String ALIAS_USERID = "用户id";
	public static final String ALIAS_REGTIME = "登记时间";
	public static final String ALIAS_ISAUTO = "是否自动";
	
	//date formats
	public static final String FORMAT_REGTIME = DATE_FORMAT;
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 序号       db_column: ID 
     */ 	
	
	private Long id;
    /**
     * 用户id       db_column: USERID 
     */ 	
	
	private Long userid;
    /**
     * 登记时间       db_column: REGTIME 
     */ 	
	
	private java.util.Date regtime;
	/**
     * 是否自动       db_column: ISAUTO 
     */ 	
	@Max(127)
	private Integer isauto;
	//columns END


	public Attendance(){
	}

	public Attendance(
		Long id
	){
		this.id = id;
	}

	

	public void setId(Long value) {
		this.id = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "increment")
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 22)
	public Long getId() {
		return this.id;
	}
	
	@Column(name = "USERID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getUserid() {
		return this.userid;
	}
	
	public void setUserid(Long value) {
		this.userid = value;
	}
	
	@Transient
	public String getRegtimeString() {
		return DateConvertUtils.format(getRegtime(), FORMAT_REGTIME);
	}
	public void setRegtimeString(String value) {
		setRegtime(DateConvertUtils.parse(value, FORMAT_REGTIME,java.util.Date.class));
	}
	
	@Column(name = "REGTIME", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getRegtime() {
		return this.regtime;
	}
	
	public void setRegtime(java.util.Date value) {
		this.regtime = value;
	}
	
	@Column(name = "ISAUTO", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getIsauto() {
		return this.isauto;
	}
	
	public void setIsauto(Integer value) {
		this.isauto = value;
	}
	
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Userid",getUserid())
			.append("Regtime",getRegtime())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Attendance == false) return false;
		if(this == obj) return true;
		Attendance other = (Attendance)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	
	private String curdate;
	private String deptname;
	private String ygbh;
	private String name;
	private Long zgts;
	private Long cbje;
	private Long[] execUsers;
	private String regtimeBegin;
	
	@Transient
	public String getRegtimeBegin() {
		return regtimeBegin;
	}

	public void setRegtimeBegin(String regtimeBegin) {
		this.regtimeBegin = regtimeBegin;
	}

	@Transient
	public Long[] getExecUsers() {
		return execUsers;
	}

	public void setExecUsers(Long[] execUsers) {
		this.execUsers = execUsers;
	}

	@Transient
	public Long getCbje() {
		return cbje;
	}

	public void setCbje(Long cbje) {
		this.cbje = cbje;
	}
	@Transient
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Transient
	public String getYgbh() {
		return ygbh;
	}

	public void setYgbh(String ygbh) {
		this.ygbh = ygbh;
	}
	@Transient
	public Long getZgts() {
		return zgts;
	}

	public void setZgts(Long zgts) {
		this.zgts = zgts;
	}

	@Transient
	public String getDeptname() {
		return deptname;
	}

	public void setDeptname(String deptname) {
		this.deptname = deptname;
	}

	@Transient
	public String getCurdate() {
		return curdate;
	}

	public void setCurdate(String curdate) {
		this.curdate = curdate;
	}
	
}

